Skip to content

BUG: detect and ignore cyclic symbolic link chains in sdist - #900

Merged
dnicolodi merged 2 commits into
mesonbuild:mainfrom
dnicolodi:fix/symlink-cycles
Sep 14, 2026
Merged

dnicolodi merged 2 commits into
mesonbuild:mainfrom
dnicolodi:fix/symlink-cycles

Conversation

@dnicolodi

Copy link
Copy Markdown
Member

Fixes #870.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnicolodi. This fix seems incomplete: it drops all symlink chains now, rather than only cycles. Try adding a ccc.py symlink to the test case, so there's a chain with length >1 (ccc -> bbb -> aaa). Then ccc.py goes missing from the sdist.

Actual file targets that symlinks point to probably need keeping track of separately.

Comment thread mesonpy/__init__.py Outdated
# Detect symbolic link chains resulting in a cycle.
if name in visited:
warnings.warn(
'symbolic link resultin in a cycle ignored: {name}', stacklevel=1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This misses the f prefix for an f-string.

@dnicolodi

Copy link
Copy Markdown
Member Author

Thanks for the review @rgommers. I also found another subtle bug for which symbolic link chains crossing directories where not resolved correctly. All problems should be fixed now. I added one more test file to make sure.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks @dnicolodi. There's one typo you may want to fix before merging, other than that it's all happy it seems.

Comment thread mesonpy/__init__.py Outdated
@rgommers rgommers added the bug Something isn't working label Sep 14, 2026
@rgommers rgommers added this to the v0.22.0 milestone Sep 14, 2026
Avoid coping the object describing the tar file member when it does
not need to be modified (directories, spacial files, and symbolic
links that have not been resolved).
@dnicolodi

Copy link
Copy Markdown
Member Author

Thanks for the review @rgommers. Typo fixed. Merging.

@dnicolodi
dnicolodi merged commit cbe2ac4 into mesonbuild:main Sep 14, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible issue with symlink cycles in sdist creation

2 participants